@import "../../scss/mixins";

:host {
    display: inline-block;
    position: relative;
    height: 21px;
    line-height: 21px;
    color: var(--dui-input-text);
    width: 150px;
    vertical-align: middle;

    background: white;
    border: 1px solid #bdbdbd;

    &.semi-transparent {
        border: 1px solid rgba(151, 151, 151, 0.28);
        background: rgba(121, 121, 121, 0.08);
    }

    &.light-focus.focused {
        border: 1px solid #949494;
    }

    &.round {
        border-radius: 4px;
    }

    &.disabled {
        color: #c5c5c5;
        pointer-events: none;
        border: 1px solid #d4d4d4;

        > * {
            opacity: 0.6;
        }

        .clearer {
            opacity: 0;
        }
    }
}

:host.no-controls {
    input::-webkit-outer-spin-button,
    input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    input {
        -moz-appearance: textfield;
    }
}

:host:not(.is-textarea) {
    display: inline-flex;
    align-items: center;
}

:host.is-textarea {
    height: 60px;
}

textarea, input {
    border: 0;
    min-width: 20px;
    color: var(--dui-input-text);
    font: normal 13px system-ui, sans-serif;
    background-color: transparent;
    height: 100%;
    line-height: 17px;
    padding: 0 4px;
    vertical-align: top;
    resize: none;
    width: 100%;

    &::placeholder {
        color: #b6b6b6;
    }

    &:focus {
        outline: 0;
    }
}

:host-context(.dui-theme-dark) {
    textarea, input {
        &::placeholder {
            color: rgba(197, 197, 197, 0.4);
        }
    }
}

textarea {
    height: 100%;
}

:host.has-icon {
    padding-left: 1px;
    //margin-right: 2px;

    textarea, input {
        padding-left: 3px;
    }
}

textarea {
    padding-top: 2px;
    line-height: 17px;
}

:host.semi-transparent {
    dui-icon {
        opacity: 0.7;
    }
}


:host dui-icon.clearer {
    //right: 5px;
    //left: auto;
    //top: 3px;
    margin-right: 2px;
    opacity: 0;
    transition: opacity 0.2s ease-in;
    cursor: pointer;
    color: #b8babc;
    pointer-events: none;
}

//:host.has-icon {
//    .input-wrapper {
//        margin-left: 18px;
//    }
//}
//
//:host.has-clearer {
//    .input-wrapper {
//        margin-right: 18px;
//    }
//}

:host.filled .clearer {
    opacity: 1;
    pointer-events: all;
}

:host.textured {
    @include box-textured;

    &:not(.light-focus).focused {
        border: 1px solid #4991bc;
    }
}

:host-context(.dui-theme-dark) {
    background-image: linear-gradient(-180deg, #3D3D3D 0%, #414141 10%, #414141 100%);

    &.semi-transparent {
        border: 1px solid rgba(151, 151, 151, 0.28);
        background: rgba(121, 121, 121, 0.08);
    }

    border-top: 1px solid #565656;
    border-bottom: 1px solid #565656;
    border-left: 1px solid #484848;
    border-right: 1px solid #484848;


    &.light-focus.focused {
        border: 1px solid #5d666e;
    }
}

:host-context(.dui-theme-dark).textured {
    @include box-textured-dark-toolbar;
}
